package org.example.tool;

import lombok.Data;

import java.util.Optional;

/**
 * @author Axin
 * @summary 一个User类定义
 * （Ps：Data 是lombok组件提供的注解，简化了get set等等的约定代码）
 * @since 2020-09-20
 */
@Data
public class User1 {

    private String email;

    private String name;

    private String position;

    private Address address;


    public User1(String email, String name) {
        this.email = email;
        this.name = name;
    }


    public Optional<Address> getAddress() {
        return Optional.ofNullable(address);
    }


    public Optional<String> getPosition() {
        return Optional.ofNullable(position);
    }


}

@Data
 class Address {
    private Country country;

    public Optional<Country> getCountry() {
        return Optional.ofNullable(country);
    }

    // ...
}

@Data
class Country {
   private String isocode;
    // ...
}